package com.ly.lw.styledo.ui;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.view.Window;
import android.widget.ImageView;
import android.widget.TextView;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ContentView;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.ly.lw.styledo.R;
import com.ly.lw.styledo.fragment.CategoryInfoFragment;

/**
 * @author 王学玲
 *         分类-推荐-详情
 */

@ContentView(R.layout.activity_category_info)
public class CategoryInfoActivity extends FragmentActivity {

    private int cateno;//传参
    private String cateName;
    @ViewInject(R.id.category_info_title)
    private TextView title;

    @ViewInject(R.id.category_info_back)
    private ImageView backImg;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);

//        Toast.makeText(this, "111---->>>" + cateno, Toast.LENGTH_SHORT).show();
        ViewUtils.inject(this);
        cateno = getIntent().getIntExtra("cateno", 0);
        cateName = getIntent().getStringExtra("catename");
        if (cateName != null) {
            title.setText(cateName);
        }

        backImg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.add(R.id.category_info_container, CategoryInfoFragment.newInstance(cateno));
        ft.commit();
    }


}
